package com.javaspeak.designpatterns.go4.behavioural.command;

import java.util.Map;

/**
 * The RequestProcessor calls the execute(..) method of Command passing in the
 * request and response to it.
 * <p>
 * The Command to call the execute() method on is retrieved from the
 * RequestType stored in the request.
 *
 * @author John Dickerson
 */
public interface Request {

    /**
     * The requestId provides a unique identify for the request. The current
     * implementation does not use it.
     *
     * @return requestId The requestId unique identifies the request
     */
    public Long getRequestId();


    /**
     * The RequestType holds the mapping to a Command
     *
     * The RequestProcessor uses the RequestType from a Request to retrieve
     * the Command to call execute(..) on.
     *
     * @return RequestType RequestType holds the mapping to a Command
     */
    public RequestType getRequestType();


    /**
     * Retrieves a map of Request attributes which are String key value pairs.
     * <p>
     * The idea is that the execute(..) method of Command will read the request
     * attributes; process them and then return them in a new map via the
     * callback method handleResponse(..) in the response argument of the
     * execute(..) method
     *
     * @return Map of modified attributes
     */
    public Map<String,String> getRequestAttributes();
}